// JavaScript Document

state = jQuery.noConflict();
 state().ready(function() {
					
                    state("#profile-state-node-form").validate({
					rules: {
						'title': { 
							required: true,
							minlength: 5,
							maxlength: 255,
							
							badchar:true,
						},
						'field_tn_population[und][0][value]':{
							required: true,
							minlength: 5,
							maxlength: 255,
							
							badchar:true,	
						},
						'field_tn_capital[und][0][value]':{
							required: true,
							minlength: 5,
							maxlength: 255,
							badchar:true,	
						},
						'field_tn_languages[und][0][value]':{
							required: true,
							minlength: 5,
							maxlength: 255,
							badchar:true,
						},
					},
					messages:{
						'title': { 
							required: 'Please Enter the Area',
							minlength: 'Minimum 5 characters should be entered',
							maxlength: 'Maximum 255 character only allowed',
							badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed' ,
						},
						'field_tn_population[und][0][value]':{
							required: 'Please Enter the Population',
							minlength: 'Minimum 5 characters should be entered',
							maxlength: 'Maximum 255 character only allowed',
							badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed',	
						},
						'field_tn_capital[und][0][value]':{
							required: 'Please Enter the Capital',
							minlength: 'Minimum 5 characters should be entered',
							maxlength:'Maximum 255 character only allowed',
							badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed',	
						},
						'field_tn_languages[und][0][value]':{
							required: 'Please Enter the languages',
							minlength: 'Minimum 5 characters should be entered',
							maxlength: 'Maximum 255 character only allowed',
							badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed',
						},
					},
						invalidHandler: function(form, validator) {
       
       					 if (!validator.numberOfInvalids())
								return;
						else{
							
							  //state("#documents-node-form").create_errormsg_container('errormsg_container','documents-node-form');
						}
							
							state('html, body').animate({
								scrollTop: state(validator.errorList[0].element).offset().top - 100
							}, 1000);
							
						},
				

   
	});




            
});
						